## Effectiveness Experiment Russia and Venezuela :  Do File

# Load libraries

library(foreign)
library(data.table)
library(stargazer)
library(ggplot2)
library(xtable)
library(arm)
library(mlogit)
library(nnet)
library(car)
library(erer)
library(lfe)
library(rms)
library(prediction)
library(glm.predict)
library(multcomp)
library(mfx)


#Data
rm(list=ls())
specify_decimal <- function(x, k) format(as.numeric(round(x, k), nsmall=k))
mod_stargazer <- function(est) {
  capture.output(est)
}

#### Load Each of the Survey Datasets based on your Working Directory
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
load("RussiaSurveyData.Rda")
load("VenezuelaSurveyData.Rda")

rus_emp<-subset(rus, employed==1)
ven_emp<-subset(ven, employed==1)



#########################################################
#############     MAIN TEXT           ###################
#########################################################


###########################################
########     FIGURE 1      ################
###########################################

####### Panel A

rus_d<-rus[rus$employed==1][,list(expoutcome_m=mean(expoutcome)),by=c("strategy","broker")]
rus_d$broker<-as.character(rus_d$broker)
rus_d$broker[rus_d$broker=="Employer"]<-" Employer"
rus_d$broker[rus_d$broker=="Party"]<-" Party Activist"
rus_d$broker[rus_d$broker=="Official"]<-"Government Official"

fig1_panela<-ggplot(data=rus_d, aes(x=broker, y=expoutcome_m, fill=strategy)) + geom_bar(colour="black", stat="identity",position=position_dodge(),size=.3)+ scale_fill_grey( name="",breaks=c("0", "1", "2","3"),labels=c("Simple Ask     ", "Organizational Threat     ", "Turnout-Buying     ","Individual Threat"))+    xlab("") + ylab("Likelihood of Voting") + theme_bw()+ theme(legend.position="bottom",axis.text=element_text(size=14),axis.text.x=element_text(face = "bold"),axis.title.y=element_text(size=14),legend.text=element_text(size=12),plot.title = element_text(hjust = 0.5,size=16))+ coord_cartesian(ylim=c(2.25,3.25))+ geom_text(aes(label=specify_decimal(expoutcome_m,2)), position=position_dodge(width=0.9), vjust=-0.4)+ggtitle("Panel A: Russia Survey")

####### Panel B

ven_d<-ven[ven$employed==1][,list(vote_intent_m=mean(vote_intent,na.rm=TRUE)),by=c("strategy_number","broker")]
ven_d$broker<-as.character(ven_d$broker)
ven_d$broker[ven_d$broker=="Employer"]<-" Employer"
ven_d$broker[ven_d$broker=="Party"]<-" Party Activist"
ven_d$broker[ven_d$broker=="Official"]<-"Neighborhood Leader"

fig1_panelb<-ggplot(data=ven_d, aes(x=broker, y=vote_intent_m, fill=strategy_number)) + geom_bar(colour="black", stat="identity",position=position_dodge(),size=.3)+ scale_fill_grey( name="",breaks=c("0", "1", "2","3"),labels=c("Simple Ask     ", "Organizational Threat     ", "Turnout-Buying     ","Individual Threat"))+    xlab("") + ylab("Likelihood of Voting") + theme_bw()+ theme(legend.position="bottom",axis.text=element_text(size=14),axis.text.x=element_text(face = "bold"),axis.title.y=element_text(size=14),legend.text=element_text(size=12),plot.title = element_text(hjust = 0.5,size=16))+ coord_cartesian(ylim=c(2,4.5))+ geom_text(aes(label=specify_decimal(vote_intent_m,2)), position=position_dodge(width=0.9), vjust=-0.4)+ggtitle("\n\nPanel B: Venezuela Survey")


###########################################
########     FIGURE 2      ################
###########################################

interval <- -qnorm((1-0.95)/2)  # 95% multiplier

####### Panel A

### Brokers
emp_diff<-lm(expoutcome~factor(employer4), data=subset(rus,employed==1))
party_diff<-lm(expoutcome~factor(activist4), data=subset(rus,employed==1))
official_diff<-lm(expoutcome~factor(official4), data=subset(rus,employed==1))

### Strategies
gift_diff<-lm(expoutcome~factor(gift4), data=subset(rus,employed==1))
threat_diff<-lm(expoutcome~factor(threat4), data=subset(rus,employed==1))
benign_diff<-lm(expoutcome~factor(benign4), data=subset(rus,employed==1))
org_diff<-lm(expoutcome~factor(org4), data=subset(rus,employed==1))

coefficients<-data.frame(var=as.character(),fe = as.numeric(),se= as.numeric(), subset=as.character())

coefficients<-rbind(coefficients,data.frame(var="strategies",fe = summary(benign_diff)$coefficients[,1][2],se= summary(benign_diff)$coefficients[,2][2], subset="Simple Ask     "))
coefficients<-rbind(coefficients,data.frame(var="strategies",fe = summary(org_diff)$coefficients[,1][2],se= summary(org_diff)$coefficients[,2][2], subset="Organizational Threat     "))
coefficients<-rbind(coefficients,data.frame(var="strategies",fe = summary(gift_diff)$coefficients[,1][2],se= summary(gift_diff)$coefficients[,2][2], subset="Turnout-Buying     "))
coefficients<-rbind(coefficients,data.frame(var="strategies",fe = summary(threat_diff)$coefficients[,1][2],se= summary(threat_diff)$coefficients[,2][2], subset="Individual Threat"))

coefficients<-rbind(coefficients,data.frame(var="brokers",fe = summary(emp_diff)$coefficients[,1][2],se= summary(emp_diff)$coefficients[,2][2], subset="Employer"))
coefficients<-rbind(coefficients,data.frame(var="brokers",fe = summary(party_diff)$coefficients[,1][2],se= summary(party_diff)$coefficients[,2][2], subset="Party Activist"))
coefficients<-rbind(coefficients,data.frame(var="brokers",fe = summary(official_diff)$coefficients[,1][2],se= summary(official_diff)$coefficients[,2][2], subset="Government Official"))

coefficients <- within(coefficients,
                       var <- ordered(var, levels = rev(sort(unique(var)))))
secbreaks = rev(unique(as.character(coefficients$var)))

# Plot
fig2_panela<-ggplot(coefficients, aes(colour = subset))+ geom_hline(yintercept = 0, colour = gray(1/2), lty = 2)+ geom_linerange(aes(x = var, ymin = fe - se*interval, ymax = fe + se*interval),lwd = 1, position = position_dodge(width = 1/2))+ geom_pointrange(aes(x = var, y = fe, ymin = fe - se*interval,ymax = fe + se*interval), lwd = 1/2, position = position_dodge(width = 1/2), shape = 21, fill = "WHITE")+ theme_bw()+ ylab("Difference in Means")+ xlab(" ")+ scale_x_discrete(breaks=secbreaks,labels=c('Difference: Between Brokers','Difference: Between Inducements')) + guides(colour=guide_legend(ncol=2))+ scale_colour_grey(name="Inducements                              Brokers")+theme(axis.text = element_text(size=12),axis.title = element_text(size=12),legend.text=element_text(size=10),plot.title = element_text(hjust = 1.25,size=16))+ggtitle("Panel A: Russia Survey")

####### Panel B

### Brokers
emp_diff<-lm(vote_intent~factor(employer), data=subset(ven,employed==1))
party_diff<-lm(vote_intent~factor(partyactivist), data=subset(ven,employed==1))
leader_diff<-lm(vote_intent~factor(leader), data=subset(ven,employed==1))

### Strategies
gift_diff<-lm(vote_intent~factor(gift), data=subset(ven,employed==1))
threat_diff<-lm(vote_intent~factor(indthreat), data=subset(ven,employed==1))
benign_diff<-lm(vote_intent~factor(benign), data=subset(ven,employed==1))
org_diff<-lm(vote_intent~factor(orgthreat), data=subset(ven,employed==1))

coefficients<-data.frame(var=as.character(),fe = as.numeric(),se= as.numeric(), subset=as.character())

coefficients<-rbind(coefficients,data.frame(var="strategies",fe = summary(benign_diff)$coefficients[,1][2],se= summary(benign_diff)$coefficients[,2][2], subset="Simple Ask     "))
coefficients<-rbind(coefficients,data.frame(var="strategies",fe = summary(org_diff)$coefficients[,1][2],se= summary(org_diff)$coefficients[,2][2], subset="Organizational Threat     "))
coefficients<-rbind(coefficients,data.frame(var="strategies",fe = summary(gift_diff)$coefficients[,1][2],se= summary(gift_diff)$coefficients[,2][2], subset="Turnout-Buying     "))
coefficients<-rbind(coefficients,data.frame(var="strategies",fe = summary(threat_diff)$coefficients[,1][2],se= summary(threat_diff)$coefficients[,2][2], subset="Individual Threat"))

coefficients<-rbind(coefficients,data.frame(var="brokers",fe = summary(emp_diff)$coefficients[,1][2],se= summary(emp_diff)$coefficients[,2][2], subset="Employer"))
coefficients<-rbind(coefficients,data.frame(var="brokers",fe = summary(party_diff)$coefficients[,1][2],se= summary(party_diff)$coefficients[,2][2], subset="Party Activist"))
coefficients<-rbind(coefficients,data.frame(var="brokers",fe = summary(leader_diff)$coefficients[,1][2],se= summary(leader_diff)$coefficients[,2][2], subset="Neighborhood Leader"))

coefficients <- within(coefficients,
                       var <- ordered(var, levels = rev(sort(unique(var)))))
secbreaks = rev(unique(as.character(coefficients$var)))

fig2_panelb<-ggplot(coefficients, aes(colour = subset))+ geom_hline(yintercept = 0, colour = gray(1/2), lty = 2)+ geom_linerange(aes(x = var, ymin = fe - se*interval, ymax = fe + se*interval),lwd = 1, position = position_dodge(width = 1/2))+ geom_pointrange(aes(x = var, y = fe, ymin = fe - se*interval,ymax = fe + se*interval), lwd = 1/2, position = position_dodge(width = 1/2), shape = 21, fill = "WHITE")+ theme_bw()+ ylab("Difference in Means")+ xlab(" ")+ scale_x_discrete(breaks=secbreaks,labels=c('Difference: Between Brokers','Difference: Between Inducements')) +  guides(colour=guide_legend(ncol=2))+ scale_colour_grey(name="Inducements                              Brokers")+theme(axis.text = element_text(size=12),axis.title = element_text(size=12),legend.text=element_text(size=10),plot.title = element_text(hjust = 1.25,size=16))+ggtitle("\nPanel B: Venezuela Survey")

###########################################
########     FIGURE 3      ################
###########################################


df <- data.frame(name= numeric(0),coefs= numeric(0),se= numeric(0),value= numeric(0))

### Leverage

est1<-felm(expoutcome~empparty*perclosejob100+ citysize +  male + logage + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

df<-rbind(df,cbind("perclosejob100",
                   summary(glht(est1, linfct = c("empparty + empparty:perclosejob100 == 0")))$test$coefficients,
                   summary(glht(est1, linfct = c("empparty + empparty:perclosejob100 == 0")))$test$sigma,"1"))

df<-rbind(df,cbind("perclosejob100",
                   summary(glht(est1, linfct = c("empparty==0")))$test$coefficients,
                   summary(glht(est1, linfct = c("empparty==0")))$test$sigma,"0"))

est2<-felm(expoutcome~empparty*findnewwork+ citysize +  male + logage + edu + gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

df<-rbind(df,cbind("findnewwork",
                   summary(glht(est2, linfct = c("empparty + empparty:findnewwork*5 == 0")))$test$coefficients,
                   summary(glht(est2, linfct = c("empparty + empparty:findnewwork*5 == 0")))$test$sigma,"1"))

df<-rbind(df,cbind("findnewwork",
                   summary(glht(est2, linfct = c("empparty==0")))$test$coefficients,
                   summary(glht(est2, linfct = c("empparty==0")))$test$sigma,"0"))

rus$num_benefits<-as.numeric(as.character(rus$num_benefits))
est3<-felm(expoutcome~empparty*num_benefits+ citysize +  male + logage + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

df<-rbind(df,cbind("num_benefits",
                   summary(glht(est3,linfct = c("empparty + empparty:num_benefits == 0")))$test$coefficients,
                   summary(glht(est3, linfct = c("empparty + empparty:num_benefits == 0")))$test$sigma,"1"))

df<-rbind(df,cbind("num_benefits",
                   summary(glht(est3, linfct = c("empparty==0")))$test$coefficients,
                   summary(glht(est3, linfct = c("empparty==0")))$test$sigma,"0"))

est4<-felm(expoutcome~empparty*gov+ citysize +  male + logage + edu+gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

df<-rbind(df,cbind("gov",
                   summary(glht(est4, linfct = c("empparty + empparty:gov == 0")))$test$coefficients,
                   summary(glht(est4, linfct = c("empparty + empparty:gov == 0")))$test$sigma,"1"))

df<-rbind(df,cbind("gov",
                   summary(glht(est4, linfct = c("empparty==0")))$test$coefficients,
                   summary(glht(est4, linfct = c("empparty==0")))$test$sigma,"0"))

### Monitoring

est5<-felm(expoutcome~empparty*supervisor+ citysize +  male + logage + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))


df<-rbind(df,cbind("supervisor",
                   summary(glht(est5, linfct = c("empparty + empparty:supervisor*3 == 0")))$test$coefficients,
                   summary(glht(est5, linfct = c("empparty + empparty:supervisor*3 == 0")))$test$sigma,"1"))

df<-rbind(df,cbind("supervisor",
                   summary(glht(est5, linfct = c("empparty==0")))$test$coefficients,
                   summary(glht(est5, linfct = c("empparty==0")))$test$sigma,"0"))

est6<-felm(expoutcome~empparty*lengthwork+ citysize +  male + logage + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

df<-rbind(df,cbind("lengthwork",
                   summary(glht(est6, linfct = c("empparty + empparty:lengthwork*50 == 0")))$test$coefficients,
                   summary(glht(est6, linfct = c("empparty + empparty:lengthwork*50 == 0")))$test$sigma,"1"))

df<-rbind(df,cbind("lengthwork",
                   summary(glht(est6, linfct = c("empparty==0")))$test$coefficients,
                   summary(glht(est6, linfct = c("empparty==0")))$test$sigma,"0"))


est7<-felm(expoutcome~empparty*coworker_weekly+ citysize +  male + logage + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

df<-rbind(df,cbind("coworker_weekly",
                   summary(glht(est7, linfct = c("empparty + empparty:coworker_weekly*2 == 0")))$test$coefficients,
                   summary(glht(est7, linfct = c("empparty + empparty:coworker_weekly*2 == 0")))$test$sigma,"1"))

df<-rbind(df,cbind("coworker_weekly",
                   summary(glht(est7, linfct = c("empparty==0")))$test$coefficients,
                   summary(glht(est7, linfct = c("empparty==0")))$test$sigma,"0"))

coefficients <- within(coefficients,
                       var <- ordered(var, levels = rev(sort(unique(var)))))
secbreaks = rev(unique(as.character(coefficients$var)))

names(df)<-c("variable","coef","se","on")
df$leverage<-c(rep(1,8),rep(0,6))
df$coef<-as.numeric(as.character(df$coef))
df$se<-as.numeric(as.character(df$se))
df$variable<-as.character(df$variable)
df$variable[df$variable=="perclosejob100"]<-"     perclosejob100"
df$variable[df$variable=="findnewwork"]<-"    findnewwork"
df$variable[df$variable=="num_benefits"]<-"    num_benefits"
df$variable[df$variable=="gov"]<-"   gov"
df$variable[df$variable=="supervisor"]<-"  supervisor"
df$variable[df$variable=="lengthwork"]<-" lengthwork"
df$variable[df$variable=="coworker_weekly"]<-"coworker_weekly"
df$leverage<-as.character(df$leverage)

df$variablewhite = factor(df$variable, levels=c("Leverage ","     perclosejob100","    findnewwork", "    num_benefits","   gov","Monitoring","  supervisor"," lengthwork","coworker_weekly"))

df$variablefill<-paste(df$variable,df$on,sep="_")

fig3<-ggplot(df, aes(colour = variable,fill=variablefill))+ geom_linerange(aes(x = variablefill, ymin = coef - se*interval, ymax = coef + se*interval),lwd = 1, position = position_dodge(width = 1/2))+ geom_pointrange(aes(x = variablefill, y = coef, ymin = coef - se*interval,ymax = coef + se*interval), lwd = 1/2, position = position_dodge(width = 1/2), shape = 21, fill = "WHITE")+ geom_hline(yintercept = 0, colour = gray(1/2), lty = 2)+ theme_bw()+ scale_x_discrete(breaks=df$variablefill,labels=c('100','0','Yes','No','Yes','No','Yes','No','Yes','No','50','0','Yes','No'))+ ylab("Effect of Employer Treatment on Turnout\t")+ xlab("\nLeverage                            Monitoring")+
  guides(colour=guide_legend(ncol=2))+ scale_colour_grey(name="",labels = c("Chance of Job Loss", "Hard to Find a New Job","Receives Benefits","Employed in Government","Knows Supervisor Well","Number of Years Employed","Socializes with Coworkers"))+theme(legend.position="bottom",axis.text = element_text(size=16),axis.title = element_text(size=16),legend.text=element_text(size=14))





###########################################
########     TABLE 1      ################
###########################################

### Panel A

rus$induce="Asked You to Vote"
rus$induce[rus$gift4==1]="Offers You a Gift, Money, or Reward for Voting"
rus$induce[rus$org4==1]="Tells You That Your Firm or Org. Will Suffer if Turnout Among Employees is Low"
rus$induce[rus$threat4==1]="Indicates There Will be Negative Consequences For You If You Do Not Vote"

rus$brokertable="  Your Employer"
rus$brokertable[rus$broker=="Party"]=" A Party Activist"
rus$brokertable[rus$broker=="Official"]="A Government Official"

RussiaPercTable<-table(rus$brokertable,rus$induce)

### Panel B

ven$induce="Asked You to Vote"
ven$induce[ven$strategy=="Gift"]="Offers You a Gift, Money, or Reward for Voting"
ven$induce[ven$strategy=="OrgThreat"]="Tells You That Your Firm or Org. Will Suffer if Turnout Among Employees is Low"
ven$induce[ven$strategy=="IndThreat"]="Indicates There Will be Negative Consequences For You If You Do Not Vote"

ven$brokertable="  Your Employer"
ven$brokertable[ven$broker=="Party"]=" A Party Activist"
ven$brokertable[ven$broker=="Neighborhood Leader"]="A Neighborhood Leader"

VenezuelaPercTable<-table(ven$brokertable,ven$induce)


###########################################
########     TABLE 2      ################
###########################################


rus_emp$expoutcome_f<-factor(rus_emp$expoutcome)

### Employer
t<-polr(expoutcome_f~employer4,data=rus_emp, method = "logistic")
probs<-as.data.frame(predict(t, type="probs"))
names(probs)=c("o1","o2","o3","o4","o5")
rus_p<-cbind(rus_emp,probs)
rusemployer_high<-mean(rus_p$o4[rus_p$employer4==1]) + mean(rus_p$o5[rus_p$employer4==1])
rusemployer_low<-mean(rus_p$o1[rus_p$employer4==1]) + mean(rus_p$o2[rus_p$employer4==1])

### Activist
t<-polr(expoutcome_f~activist4,data=rus_emp, method = "logistic")
probs<-as.data.frame(predict(t, type="probs"))
names(probs)=c("o1","o2","o3","o4","o5")
rus_p<-cbind(rus_emp,probs)
rusactivist_high<-mean(rus_p$o4[rus_p$activist4==1]) + mean(rus_p$o5[rus_p$activist4==1])
rusactivist_low<-mean(rus_p$o1[rus_p$activist4==1]) + mean(rus_p$o2[rus_p$activist4==1])


### Official
t<-polr(expoutcome_f~official4,data=rus_emp, method = "logistic")
probs<-as.data.frame(predict(t, type="probs"))
names(probs)=c("o1","o2","o3","o4","o5")
rus_p<-cbind(rus_emp,probs)
rusofficial_high<-mean(rus_p$o4[rus_p$official4==1]) + mean(rus_p$o5[rus_p$official4==1])
rusofficial_low<-mean(rus_p$o1[rus_p$official4==1]) + mean(rus_p$o2[rus_p$official4==1])


###### VENEZUELA PROBABILITY TABLE

ven_emp$vote_intent_f<-factor(ven_emp$vote_intent)
ven_f<-subset(ven_emp, is.na(vote_intent_f)==FALSE)

### Employer
t<-polr(vote_intent_f~employer,data=ven_f, method = "logistic")
probs<-as.data.frame(predict(t, type="probs"))
names(probs)=c("o1","o2","o3","o4","o5")
ven_p<-cbind(ven_f,probs)
venemployer_high<-mean(ven_p$o4[ven_p$employer==1]) + mean(ven_p$o5[ven_p$employer==1])
venemployer_low<-mean(ven_p$o1[ven_p$employer==1]) + mean(ven_p$o2[ven_p$employer==1])

### Activist
t<-polr(vote_intent_f~partyactivist,data=ven_f, method = "logistic")
probs<-as.data.frame(predict(t, type="probs"))
names(probs)=c("o1","o2","o3","o4","o5")
ven_p<-cbind(ven_f,probs)
venactivist_high<-mean(ven_p$o4[ven_p$partyactivist==1]) + mean(ven_p$o5[ven_p$partyactivist==1])
venactivist_low<-mean(ven_p$o1[ven_p$partyactivist==1]) + mean(ven_p$o2[ven_p$partyactivist==1])

### Leader
t<-polr(vote_intent_f~leader,data=ven_f, method = "logistic")
probs<-as.data.frame(predict(t, type="probs"))
names(probs)=c("o1","o2","o3","o4","o5")
ven_p<-cbind(ven_f,probs)
venleader_high<-mean(ven_p$o4[ven_p$leader==1]) + mean(ven_p$o5[ven_p$leader==1])
venleader_low<-mean(ven_p$o1[ven_p$leader==1]) + mean(ven_p$o2[ven_p$leader==1])


PanelASummaryTable <- data.frame(brokers= numeric(0),rusprob= numeric(0),venprob= numeric(0))
PanelASummaryTable[1 ,] <- c("Employer",specify_decimal(c(rusemployer_high*100,venemployer_high*100),1))
PanelASummaryTable[2 ,] <- c("Party Activist",specify_decimal(c(rusactivist_high*100,venactivist_high*100),1))
PanelASummaryTable[3 ,] <- c("Government Official",specify_decimal(rusofficial_high*100,1),"")
PanelASummaryTable[4 ,] <- c("Neighborhood Leader","",specify_decimal(venleader_high*100,1))

colnames(PanelASummaryTable) <- c(" ","Russia","Venezuela")



PanelBSummaryTable <- data.frame(brokers= numeric(0),rusprob= numeric(0),venprob= numeric(0))

PanelBSummaryTable[1 ,] <- c("Employer",specify_decimal(c(rusemployer_low*100,venemployer_low*100),1))
PanelBSummaryTable[2 ,] <- c("Party Activist",specify_decimal(c(rusactivist_low*100,venactivist_low*100),1))
PanelBSummaryTable[3 ,] <- c("Government Official",specify_decimal(rusofficial_low*100,1),"")
PanelBSummaryTable[4 ,] <- c("Neighborhood Leader","",specify_decimal(venleader_low*100,1))

colnames(PanelBSummaryTable) <- c(" ","Russia","Venezuela")





###########################################
########     TABLE 3      ################
###########################################

### Leverage

est1<-felm(expoutcome~empparty*perclosejob100+ citysize +  male + logage + polinterest  + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

est2<-felm(expoutcome~empparty*findnewwork+ citysize +  male + logage + polinterest  + edu + gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

est3<-felm(expoutcome~empparty*num_benefits+ citysize +  male + logage + polinterest  + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

est4<-felm(expoutcome~empparty*gov+ citysize +  male + logage + polinterest  + edu+gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

### Monitoring

est5<-felm(expoutcome~empparty*supervisor+ citysize +  male + logage + polinterest  + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

est6<-felm(expoutcome~empparty*lengthwork+ citysize +  male + logage + polinterest  + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

est7<-felm(expoutcome~empparty*coworker_weekly+ citysize +  male + logage + polinterest  + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))



#########################################################
#############     APPENDIX            ###################
#########################################################

###########################################
########     TABLE A1      ################
###########################################

mm <- multinom(fulltreatment ~ citysize + familyecon + male + logage + edu +  employed, data=rus, trace=F)
tab_a1<-Anova(mm)
cdfs_mlog<-mlogit.data(rus, choice="fulltreatment",shape="wide")
t_mlog<-mlogit(fulltreatment ~ 0 | citysize + familyecon + male + logage + edu +  employed, data = as.data.frame(cdfs_mlog))
names(summary(t_mlog)[17])

chi<-specify_decimal(do.call(rbind, summary(t_mlog)[17])[[1]][1],2)

p<-specify_decimal(do.call(rbind, summary(t_mlog)[17])[[3]][1],4)

rownames( tab_a1 ) <- c("City Size","Household Economic Situation","Male","Age (log)","Education","Employed")

###########################################
########     TABLE A2      ################
###########################################

mm <- multinom(treatment ~ citysize + income + male + logage + edu + employed, data=ven, trace=F)
tab_a2<-Anova(mm)
cdfs_mlog<-mlogit.data(ven, choice="treatment",shape="wide")
t_mlog<-mlogit(treatment ~ 0 | citysize + income + male + logage + edu + employed, data = as.data.frame(cdfs_mlog))

chi<-specify_decimal(do.call(rbind, summary(t_mlog)[17])[[1]][1],2)

p<-specify_decimal(do.call(rbind, summary(t_mlog)[17])[[3]][1],4)

rownames( tab_a2 ) <- c("City Size","Household Income","Male","Age (log)","Education","Employed")

###########################################
########     FIGURE A1      ###############
###########################################

rus_d<-rus[,list(expoutcome_m=mean(expoutcome)),by=c("strategy","broker")]
rus_d$broker<-as.character(rus_d$broker)
rus_d$broker[rus_d$broker=="Employer"]<-" Employer"
rus_d$broker[rus_d$broker=="Party"]<-" Party Activist"
rus_d$broker[rus_d$broker=="Official"]<-"Government Official"

fig_a1<-ggplot(data=rus_d, aes(x=broker, y=expoutcome_m, fill=strategy)) + geom_bar(colour="black", stat="identity",position=position_dodge(),size=.3)+ scale_fill_grey( name="",breaks=c("0", "1", "2","3"),labels=c("Simple Ask     ", "Organizational Threat     ", "Turnout-Buying     ","Individual Threat"))+    xlab("") + ylab("Likelihood of Voting") + theme_bw()+ theme(legend.position="bottom",axis.text=element_text(size=14),axis.text.x=element_text(face = "bold"),axis.title.y=element_text(size=14),legend.text=element_text(size=12),plot.title = element_text(hjust = 0.5,size=16))+ coord_cartesian(ylim=c(2.25,3.25))+ geom_text(aes(label=specify_decimal(expoutcome_m,2)), position=position_dodge(width=0.9), vjust=-0.4)+ggtitle("Russia Survey")

###########################################
########     TABLE A3      ################
###########################################

rus$broker<-relevel(rus$broker, ref = "Party")

est1<-felm(expoutcome~factor(broker)|0|0|0, data=subset(rus))

est2<-felm(expoutcome~factor(broker) + employed |0|0|0, data=subset(rus))

est3<-felm(expoutcome~factor(broker)|0|0|0, data=subset(rus, employed==1))

est4<-felm(expoutcome~factor(broker)|0|0|0, data=subset(rus, employed==1 & gov==1))

est5<-felm(expoutcome~factor(broker)|0|0|0, data=subset(rus, employed==1 & gov==0))

est6<-felm(expoutcome~factor(broker)|0|0|0, data=subset(rus, employed==0 & broker!="Employer"))

est7<-felm(expoutcome~factor(broker)|0|0|0, data=subset(rus, v3==1))

est8<-felm(expoutcome~factor(broker)|0|0|0, data=subset(rus, v3!=1))


###########################################
########     TABLE A4      ################
###########################################

est1<-felm(expoutcome~factor(strategy)|0|0|0, data=subset(rus))

est2<-felm(expoutcome~factor(strategy)|0|0|0, data=subset(rus, employed==1))

est3<-felm(expoutcome~factor(strategy)|0|0|0, data=subset(rus, employed==1 & gov==1))

est4<-felm(expoutcome~factor(strategy)|0|0|0, data=subset(rus, employed==1 & gov==0))

est5<-felm(expoutcome~factor(strategy)|0|0|0, data=subset(rus, employed==0 & broker!="Employer"))

est6<-felm(expoutcome~factor(strategy)|0|0|0, data=subset(rus, v3==1))

est7<-felm(expoutcome~factor(strategy)|0|0|0, data=subset(rus, v3!=1))


###########################################
########     TABLE A5      ################
###########################################

est1<-felm(expoutcome~factor(broker)|0|0|0, data=subset(rus))

est2<-felm(expoutcome~factor(broker)*edu|0|0|0, data=subset(rus))

est3<-felm(expoutcome~factor(broker)*familyincome|0|0|0, data=subset(rus))

###########################################
########     TABLE A6      ################
###########################################

est1<-felm(expoutcome~factor(strategy)|0|0|0, data=subset(rus))

est2<-felm(expoutcome~factor(strategy)*edu|0|0|0, data=subset(rus))

est3<-felm(expoutcome~factor(strategy)*familyincome|0|0|0, data=subset(rus))


###########################################
########     FIGURE A2      ###############
###########################################


ven_d<-ven[,list(vote_intent_m=mean(vote_intent,na.rm=TRUE)),by=c("strategy_number","broker")]
ven_d$broker<-as.character(ven_d$broker)
ven_d$broker[ven_d$broker=="Employer"]<-" Employer"
ven_d$broker[ven_d$broker=="Party"]<-" Party Activist"
ven_d$broker[ven_d$broker=="Neighborhood Leader"]<-"Neighborhood Leader"

fig_a2<-ggplot(data=ven_d, aes(x=broker, y=vote_intent_m, fill=strategy_number)) + geom_bar(colour="black", stat="identity",position=position_dodge(),size=.3)+ scale_fill_grey( name="",breaks=c("0", "1", "2","3"),labels=c("Simple Ask     ", "Organizational Threat     ", "Turnout-Buying     ","Individual Threat"))+    xlab("") + ylab("Likelihood of Voting") + theme_bw()+ theme(legend.position="bottom",axis.text=element_text(size=14),axis.text.x=element_text(face = "bold"),axis.title.y=element_text(size=14),legend.text=element_text(size=12),plot.title = element_text(hjust = 0.5,size=16)) + coord_cartesian(ylim=c(2,4.5))+ geom_text(aes(label=specify_decimal(vote_intent_m,2)), position=position_dodge(width=0.9), vjust=-0.4)+ggtitle("\n\nVenezuela Survey")

###########################################
########     TABLE A7      ################
###########################################

ven$broker<-relevel(factor(ven$broker), ref = "Party")

est1<-felm(vote_intent~factor(broker)|0|0|0, data=subset(ven))

est2<-felm(vote_intent~factor(broker) + employed |0|0|0, data=subset(ven))

est3<-felm(vote_intent~factor(broker)|0|0|0, data=subset(ven, employed==1))

est4<-felm(vote_intent~factor(broker)|0|0|0, data=subset(ven, employed==1 & gov==1))

est5<-felm(vote_intent~factor(broker)|0|0|0, data=subset(ven, employed==1 & gov==0))

est6<-felm(vote_intent~factor(broker)|0|0|0, data=subset(ven, employed==0 & broker!="Employer"))

###########################################
########     TABLE A8      ################
###########################################

est1<-felm(vote_intent~factor(strategy)|0|0|REGION, data=subset(ven))

est2<-felm(vote_intent~factor(strategy)|0|0|REGION, data=subset(ven, employed==1))

est3<-felm(vote_intent~factor(strategy)|0|0|REGION, data=subset(ven, employed==1 & gov==1))

est4<-felm(vote_intent~factor(strategy)|0|0|REGION, data=subset(ven, employed==1 & gov==0))

est5<-felm(vote_intent~factor(strategy)|0|0|REGION, data=subset(ven, employed==0 & broker!="Employer"))


###########################################
########     TABLE A9     ################
###########################################

est1<-felm(vote_intent~factor(broker)|0|0|REGION, data=subset(ven))

est2<-felm(vote_intent~factor(broker)*edu|0|0|REGION, data=subset(ven))

est3<-felm(vote_intent~factor(broker)*income|0|0|REGION, data=subset(ven))

###########################################
########     TABLE A10     ################
###########################################


est1<-felm(vote_intent~factor(strategy)|0|0|REGION, data=subset(ven))

est2<-felm(vote_intent~factor(strategy)*edu|0|0|REGION, data=subset(ven))

est3<-felm(vote_intent~factor(strategy)*income|0|0|REGION, data=subset(ven))


###########################################
########     TABLE A11     ################
###########################################

rus_main<-subset(rus, turnrefuseanswer2014==0 & turnhardanswer2014==0)

rus_emp_nomiss<-subset(rus, employed==1 & turnrefuseanswer2014==0 & turnhardanswer2014==0)

est1_f<-as.formula("othervoted~anywpmob + citysize +  male + logage + edu + employed + gov + familyeconchange+econsituation+polinterest+inparty+regionFE")
est1<-glm(est1_f,data=rus_main, family=binomial(link="logit"))
est1m<-logitmfx(est1_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est2_f<-as.formula("othervoted~anywpmob + citysize +  male + logage + edu + gov + owner + manager+computer+newwork3yrs+sidework+familyeconchange+econsituation+polinterest+inparty+regionFE")
est2<-glm(est2_f,data=rus_emp_nomiss, family=binomial(link="logit"))
est2m<-logitmfx(est2_f, rus_emp_nomiss, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est3_f<-as.formula("othervoted~turnemployer2014_1 + citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty+regionFE")
est3<-glm(est3_f,data=rus_main, family=binomial(link="logit"))
est3m<-logitmfx(est3_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est4_f<-as.formula("othervoted~turnemployer2014_1 + citysize +  male + logage + edu + gov + owner + manager+computer+newwork3yrs+sidework+familyeconchange+econsituation+polinterest+inparty+regionFE")
est4<-glm(est4_f,data=rus_emp_nomiss, family=binomial(link="logit"))
est4m<-logitmfx(est4_f, rus_emp_nomiss, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est5_f<-as.formula("othervoted~turnactivist2014_1 + citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty+regionFE")
est5<-glm(est5_f,data=rus_main, family=binomial(link="logit"))
est5m<-logitmfx(est5_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est6_f<-as.formula("othervoted~turnactivist2014_1 + citysize +  male + logage + edu + gov + owner + manager+computer+newwork3yrs+sidework+familyeconchange+econsituation+polinterest+inparty+regionFE")
est6<-glm(est6_f,data=rus_emp_nomiss, family=binomial(link="logit"))
est6m<-logitmfx(est6_f, rus_emp_nomiss, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est7_f<-as.formula("othervoted~turnemployer2014_1+turnactivist2014_1+turngovt2014_1 + citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty+regionFE")
est7<-glm(est7_f,data=rus_main, family=binomial(link="logit"))
est7m<-logitmfx(est7_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est8_f<-as.formula("othervoted~turnemployer2014_1+turnactivist2014_1+turngovt2014_1+ citysize +  male + logage + edu + gov + owner + manager+computer+newwork3yrs+sidework+familyeconchange+econsituation+polinterest+inparty+regionFE")
est8<-glm(est8_f,data=rus_emp_nomiss, family=binomial(link="logit"))
est8m<-logitmfx(est8_f, rus_emp_nomiss, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est9_f<-as.formula("othervoted~any_mobilization+ citysize +  male + logage + edu + gov + owner +employed + manager+computer+newwork3yrs+sidework+familyeconchange+econsituation+polinterest+inparty+regionFE")
est9<-glm(est9_f,data=rus_main, family=binomial(link="logit"))
est9m<-logitmfx(est9_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")


###########################################
########     TABLE A12     ################
###########################################

est1_f<-as.formula("othervoted~anywpmob+regionFE")
est1<-glm(est1_f,data=rus_main, family=binomial(link="logit"))
est1m<-logitmfx(est1_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est2_f<-as.formula("othervoted~anywpmob + citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty+regionFE")
est2<-glm(est2_f,data=subset(rus_main, v3==1), family=binomial(link="logit"))
est2m<-logitmfx(est2_f, subset(rus_main, v3==1), atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est3_f<-as.formula("othervoted~anywpmob + citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty+regionFE")
est3<-glm(est3_f,data=subset(rus_main, v3!=1), family=binomial(link="logit"))
est3m<-logitmfx(est3_f, subset(rus_main, v3!=1), atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est4_f<-as.formula("othervoted~anywpmob + citysize +  male + logage + edu+ employed + gov + familyincome+polinterest+inparty+regionFE")
est4<-glm(est4_f,data=rus_main, family=binomial(link="logit"))
est4m<-logitmfx(est4_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est5_f<-as.formula("othervoted~anywpmob + citysize +  male + logage + edu + gov + owner + manager+computer+newwork3yrs+sidework+familyeconchange+econsituation+polinterest+inparty+regionFE+allsectorFE")
est5<-glm(est5_f,data=rus_main, family=binomial(link="logit"))
est5m<-logitmfx(est5_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est6_f<-as.formula("othervoted~turnemployer2014_1+regionFE")
est6<-glm(est6_f,data=rus_main, family=binomial(link="logit"))
est6m<-logitmfx(est6_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est7_f<-as.formula("othervoted~turnemployer2014_1 + citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty+regionFE")
est7<-glm(est7_f,data=subset(rus_main, v3==1), family=binomial(link="logit"))
est7m<-logitmfx(est7_f, subset(rus_main, v3==1), atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est8_f<-as.formula("othervoted~turnemployer2014_1 + citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty+regionFE")
est8<-glm(est8_f,data=subset(rus_main, v3!=1), family=binomial(link="logit"))
est8m<-logitmfx(est8_f, subset(rus_main, v3!=1), atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est9_f<-as.formula("othervoted~turnemployer2014_1 + citysize +  male + logage + edu+ employed + gov + familyincome+polinterest+inparty+regionFE")
est9<-glm(est9_f,data=rus_main, family=binomial(link="logit"))
est9m<-logitmfx(est9_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est10_f<-as.formula("othervoted~turnemployer2014_1 + citysize +  male + logage + edu + gov + owner + manager+computer+newwork3yrs+sidework+familyeconchange+econsituation+polinterest+inparty+regionFE+allsectorFE")
est10<-glm(est10_f,data=rus_main, family=binomial(link="logit"))
est10m<-logitmfx(est10_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")


###########################################
########     TABLE A13     ################
###########################################

est1_f<-as.formula("othervoted~turnactivist2014_1+regionFE")
est1<-glm(est1_f,data=rus_main, family=binomial(link="logit"))
est1m<-logitmfx(est1_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est2_f<-as.formula("othervoted~turnactivist2014_1 + citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty+regionFE")
est2<-glm(est2_f,data=subset(rus_main, v3==1), family=binomial(link="logit"))
est2m<-logitmfx(est2_f, subset(rus_main, v3==1), atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est3_f<-as.formula("othervoted~turnactivist2014_1 + citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty+regionFE")
est3<-glm(est3_f,data=subset(rus_main, v3!=1), family=binomial(link="logit"))
est3m<-logitmfx(est3_f, subset(rus_main, v3!=1), atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est4_f<-as.formula("othervoted~turnactivist2014_1 + citysize +  male + logage + edu+ employed + gov + familyincome+polinterest+inparty+regionFE")
est4<-glm(est4_f,data=rus_main, family=binomial(link="logit"))
est4m<-logitmfx(est4_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est5_f<-as.formula("othervoted~turnactivist2014_1 + citysize +  male + logage + edu + gov + owner + manager+computer+newwork3yrs+sidework+familyeconchange+econsituation+polinterest+inparty+regionFE+allsectorFE")
est5<-glm(est5_f,data=rus_main, family=binomial(link="logit"))
est5m<-logitmfx(est5_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est6_f<-as.formula("othervoted~turngovt2014_1+regionFE")
est6<-glm(est6_f,data=rus_main, family=binomial(link="logit"))
est6m<-logitmfx(est6_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est7_f<-as.formula("othervoted~turngovt2014_1 + citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty+regionFE")
est7<-glm(est7_f,data=subset(rus_main, v3==1), family=binomial(link="logit"))
est7m<-logitmfx(est7_f, subset(rus_main, v3==1), atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est8_f<-as.formula("othervoted~turngovt2014_1 + citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty+regionFE")
est8<-glm(est8_f,data=subset(rus_main, v3!=1), family=binomial(link="logit"))
est8m<-logitmfx(est8_f, subset(rus_main, v3!=1), atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est9_f<-as.formula("othervoted~turngovt2014_1 + citysize +  male + logage + edu+ employed + gov + familyincome+polinterest+inparty+regionFE")
est9<-glm(est9_f,data=rus_main, family=binomial(link="logit"))
est9m<-logitmfx(est9_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est10_f<-as.formula("othervoted~turngovt2014_1+ citysize +  male + logage + edu + gov + owner + manager+computer+newwork3yrs+sidework+familyeconchange+econsituation+polinterest+inparty+regionFE+allsectorFE")
est10<-glm(est10_f,data=rus_main, family=binomial(link="logit"))
est10m<-logitmfx(est10_f, rus_main, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")


###########################################
########     TABLE A14     ################
###########################################


est1<-felm(turnemployer2014_1~citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty | regionFE | 0 | regionFE, data=rus_main)

est2<-felm(turnemployer2014_1~citysize +  male + logage + edu + gov + owner + manager+computer+newwork3yrs+sidework+familyeconchange+econsituation+polinterest+inparty+regionFE | regionFE | 0 | regionFE, data=rus_emp)

est3<-felm(turnemployer2014_1~citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty+ur2011 | regionFE | 0 | regionFE, data=rus_main)

est4<-felm(turnactivist2014_1~citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty | regionFE | 0 | regionFE, data=rus_main)

est5<-felm(turnactivist2014_1~citysize +  male + logage + edu + gov + owner + manager+computer+newwork3yrs+sidework+familyeconchange+econsituation+polinterest+inparty+regionFE | regionFE | 0 | regionFE, data=rus_emp)

est6<-felm(turnactivist2014_1~citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty+ur2011 | regionFE | 0 | regionFE, data=rus_main)

est7<-felm(turngovt2014_1~citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty | regionFE | 0 | regionFE, data=rus_main)

est8<-felm(turngovt2014_1~citysize +  male + logage + edu + gov + owner + manager+computer+newwork3yrs+sidework+familyeconchange+econsituation+polinterest+inparty+regionFE | regionFE | 0 | regionFE, data=rus_emp)

est9<-felm(turngovt2014_1~citysize +  male + logage + edu+ employed + gov + familyeconchange+econsituation+polinterest+inparty+ur2011 | regionFE | 0 | regionFE, data=rus_main)

###########################################
########     TABLE A15     ################
###########################################

est1_f<-as.formula("voted~wpmob + citysize + income + male + logage + edu+employed +gov+regionFE")
est1<-glm(est1_f,data=ven, family=binomial(link="logit"))
est1m<-logitmfx(est1_f, ven, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est2_f<-as.formula("voted~wpmob + citysize + income + male + logage + edu +gov + owner + manager+computer+partymember+firmsize+benefits+regionFE")
est2<-glm(est2_f,data=ven_emp, family=binomial(link="logit"))
est2m<-logitmfx(est2_f, ven_emp, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est3_f<-as.formula("voted~emp_ask + citysize + income + male + logage + edu+employed +gov+regionFE")
est3<-glm(est3_f,data=ven, family=binomial(link="logit"))
est3m<-logitmfx(est3_f, ven, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est4_f<-as.formula("voted~emp_ask + citysize + income + male + logage + edu +gov + owner + manager+computer+partymember+firmsize+benefits+regionFE")
est4<-glm(est4_f,data=ven_emp, family=binomial(link="logit"))
est4m<-logitmfx(est4_f, ven_emp, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est5_f<-as.formula("voted~activist_ask + citysize + income + male + logage + edu+employed +gov+regionFE")
est5<-glm(est5_f,data=ven, family=binomial(link="logit"))
est5m<-logitmfx(est5_f, ven, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est6_f<-as.formula("voted~activist_ask + citysize + income + male + logage + edu +gov + owner + manager+computer+partymember+firmsize+benefits+regionFE")
est6<-glm(est6_f,data=ven_emp, family=binomial(link="logit"))
est6m<-logitmfx(est6_f, ven_emp, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est7_f<-as.formula("voted~nleader_ask + citysize + income + male + logage + edu+employed +gov+regionFE")
est7<-glm(est7_f,data=ven, family=binomial(link="logit"))
est7m<-logitmfx(est7_f, ven, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est8_f<-as.formula("voted~nleader_ask + citysize + income + male + logage + edu +gov + owner + manager+computer+partymember+firmsize+benefits+regionFE")
est8<-glm(est8_f,data=ven_emp, family=binomial(link="logit"))
est8m<-logitmfx(est8_f, ven_emp, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est9_f<-as.formula("voted~emp_ask + activist_ask + nleader_ask + citysize + income + male + logage + edu+employed +gov+regionFE")
est9<-glm(est9_f,data=ven, family=binomial(link="logit"))
est9m<-logitmfx(est9_f, ven, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est10_f<-as.formula("voted~emp_ask + activist_ask + nleader_ask + citysize + income + male + logage + edu +gov + owner + manager+computer+partymember+firmsize+benefits+regionFE")
est10<-glm(est10_f,data=ven_emp, family=binomial(link="logit"))
est10m<-logitmfx(est10_f, ven_emp, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est11_f<-as.formula("voted~any_mobilization + citysize + income + male + logage + edu+employed +gov+regionFE")
est11<-glm(est11_f,data=ven, family=binomial(link="logit"))
est11m<-logitmfx(est11_f, ven, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")


###########################################
########     TABLE A16     ################
###########################################

est1_f<-as.formula("voted~emp_ask+regionFE")
est1<-glm(est1_f,data=ven, family=binomial(link="logit"))
est1m<-logitmfx(est1_f, ven, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est2_f<-as.formula("voted~emp_ask+ citysize + income + male + logage + edu +gov + owner + manager+computer+partymember+firmsize+benefits+regionFE+sectorFE")
est2<-glm(est2_f,data=ven, family=binomial(link="logit"))
est2m<-logitmfx(est2_f, ven, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est3_f<-as.formula("voted~activist_ask+regionFE")
est3<-glm(est3_f,data=ven, family=binomial(link="logit"))
est3m<-logitmfx(est3_f, ven, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est4_f<-as.formula("voted~activist_ask+ citysize + income + male + logage + edu +gov + owner + manager+computer+partymember+firmsize+benefits+regionFE+sectorFE")
est4<-glm(est4_f,data=ven, family=binomial(link="logit"))
est4m<-logitmfx(est4_f, ven, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est5_f<-as.formula("voted~nleader_ask+regionFE")
est5<-glm(est5_f,data=ven, family=binomial(link="logit"))
est5m<-logitmfx(est5_f, ven, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est6_f<-as.formula("voted~nleader_ask+ citysize + income + male + logage + edu +gov + owner + manager+computer+partymember+firmsize+benefits+regionFE+sectorFE")
est6<-glm(est6_f,data=ven, family=binomial(link="logit"))
est6m<-logitmfx(est6_f, ven, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est7_f<-as.formula("voted~emp_ask+activist_ask+nleader_ask+regionFE")
est7<-glm(est7_f,data=ven, family=binomial(link="logit"))
est7m<-logitmfx(est7_f, ven, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est8_f<-as.formula("voted~emp_ask+activist_ask+nleader_ask+ citysize + income + male + logage + edu+employed +gov+regionFE")
est8<-glm(est8_f,data=ven, family=binomial(link="logit"))
est8m<-logitmfx(est8_f, ven, atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")

est9_f<-as.formula("voted~emp_ask+activist_ask+nleader_ask+ citysize + income + male + logage + edu +gov + owner + manager+computer+partymember+firmsize+benefits+regionFE")
est9<-glm(est9_f,data=subset(ven, employed==1), family=binomial(link="logit"))
est9m<-logitmfx(est9_f, data=subset(ven, employed==1), robust = TRUE, clustervar1 = "regionFE")

est10_f<-as.formula("voted~emp_ask+activist_ask+nleader_ask+ citysize + income + male + logage + edu +gov + owner + manager+computer+partymember+firmsize+benefits+regionFE+sectorFE")
est10<-glm(est10_f,data=subset(ven, employed==1), family=binomial(link="logit"))
est10m<-logitmfx(est10_f, subset(ven, employed==1), atmean = TRUE, robust = TRUE, clustervar1 = "regionFE")


###########################################
########     TABLE A17     ################
###########################################

est1<-felm(emp_ask~citysize + income + male + logage + edu+employed +gov|regionFE|0|regionFE,data=ven)

est2<-felm(emp_ask~citysize + income + male + logage + edu +gov + owner + manager+computer+partymember+firmsize+benefits|regionFE|0|regionFE,data=ven)

est3<-felm(emp_ask~citysize + income + male + logage + edu+employed +gov+vote_ruling|regionFE|0|regionFE,data=ven)

est4<-felm(activist_ask~citysize + income + male + logage + edu+employed +gov|regionFE|0|regionFE,data=ven)

est5<-felm(activist_ask~citysize + income + male + logage + edu +gov + owner + manager+computer+partymember+firmsize+benefits|regionFE|0|regionFE,data=ven)

est6<-felm(activist_ask~citysize + income + male + logage + edu+employed +gov+vote_ruling|regionFE|0|regionFE,data=ven)


est7<-felm(nleader_ask~citysize + income + male + logage + edu+employed +gov|regionFE|0|regionFE,data=ven)

est8<-felm(nleader_ask~citysize + income + male + logage + edu +gov + owner + manager+computer+partymember+firmsize+benefits|regionFE|0|regionFE,data=ven)

est9<-felm(nleader_ask~citysize + income + male + logage + edu+employed +gov+vote_ruling|regionFE|0|regionFE,data=ven)


###########################################
########     TABLE A18     ################
###########################################

est1<-felm(expoutcome~employer4*perclosejob100+ citysize +  male + logage + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

est2<-felm(expoutcome~employer4*findnewwork+ citysize +  male + logage + edu + gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

est3<-felm(expoutcome~employer4*num_benefits+ citysize +  male + logage + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

est4<-felm(expoutcome~employer4*gov+ citysize +  male + logage + edu+gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

est5<-felm(expoutcome~employer4*supervisor+ citysize +  male + logage + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

est6<-felm(expoutcome~employer4*lengthwork+ citysize +  male + logage + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

est7<-felm(expoutcome~employer4*coworker_weekly+ citysize +  male + logage + edu+ gov|factor(strategy)|0|regionid, data=subset(rus, employed==1))

###########################################
########     TABLE A19     ################
###########################################

rus_emp$strategy_factor<-factor(rus_emp$strategy)
rus_emp$expoutcome_factor<-factor(rus_emp$expoutcome)

est_1o <- lrm(expoutcome~empparty*perclosejob100+ citysize +  male + logage + polinterest + edu+ gov+strategy_factor,data=rus_emp,x=TRUE, y=TRUE)
est_1o <- robcov(est_1o,rus_emp$regionid)

est_2o <- lrm(expoutcome~empparty*findnewwork+ citysize +  male + logage + polinterest + edu+ gov+strategy_factor,data=rus_emp,x=TRUE, y=TRUE)
est_2o <- robcov(est_2o,rus_emp$regionid)

est_3o <- lrm(expoutcome~empparty*num_benefits+ citysize +  male + logage + polinterest + edu+ gov+strategy_factor,data=rus_emp,x=TRUE, y=TRUE)
est_3o <- robcov(est_3o,rus_emp$regionid)

est_4o <- lrm(expoutcome~empparty*gov+ citysize +  male + logage + polinterest + edu+ gov+strategy_factor,data=rus_emp,x=TRUE, y=TRUE)
est_4o <- robcov(est_4o,rus_emp$regionid)

est_5o <- lrm(expoutcome~empparty*supervisor+ citysize +  male + logage + polinterest + edu+ gov+strategy_factor,data=rus_emp,x=TRUE, y=TRUE)
est_5o <- robcov(est_5o,rus_emp$regionid)

est_6o <- lrm(expoutcome~empparty*lengthwork+ citysize +  male + logage + polinterest + edu+ gov+strategy_factor,data=rus_emp,x=TRUE, y=TRUE)
est_6o <- robcov(est_6o,rus_emp$regionid)

est_7o <- lrm(expoutcome~empparty*coworker_weekly+ citysize +  male + logage + edu+ gov+strategy_factor,data=rus_emp,x=TRUE, y=TRUE)
est_7o <- robcov(est_7o,rus_emp$regionid)


###########################################
########     TABLE A20     ################
###########################################

ven$empparty<-ifelse(ven$broker=="Employer",1,0)
ven$empparty[ven$broker=="Neighborhood Leader"]<-NA

est1<-felm(vote_intent~empparty*program+ citysize +  male + logage + edu+ gov|factor(strategy)|0|REGION, data=subset(ven, employed==1))

ven$political<-ven$V12
ven$political[ven$V12=="99"]<-NA

est2<-felm(vote_intent~empparty*gov+ citysize +  male + logage + edu+ gov|0|0|REGION, data=subset(ven, employed==1))


###########################################
########     TABLE A22     ################
###########################################

rus_sum <- rus[,list(anywpmob,turnemployer2014_1,turnactivist2014_1,turngovt2014_1,citysize,econsituation,familyeconchange,familyincome,male,logage,edu,employed,gov,firmsize,owner, manager,computer,newwork3yrs,sidework,polinterest,inparty,perclosejob100,findnewwork,num_benefits,supervisor,lengthwork,coworker_weekly)]

t<-mod_stargazer(stargazer(rus_sum,summary=TRUE,title="Russia Survey",covariate.labels=c("Mobilized in Workplace","Asked by Boss to Turn Out","Asked by Party Official to Turn Out","Asked by Gov. Official to Turn Out","City Size","Household Economic Situation","Change in Household Economic Situation","Household Income","Male","Age (log)","Education","Employed","Government Employee","Organization Size","Firm Owner","Manager","Importance of Computer Skills at Work","Changed Work in Past 3 Years (0/1)","Has Side Job","Interest in Politics","Member of Political Party","Chance of Job Loss","Hard to Find a New Job","Receives Benefits","Knows Supervisor Well","Number of Years Employed","Socializes with Coworkers"),font.size="footnotesize", digits=2,digits.extra=0,label="russummary",column.sep.width = "-3pt"))

rus_sum_emp <- rus[rus$employed==1][,list(anywpmob,turnemployer2014_1,turnactivist2014_1,turngovt2014_1)]

t1<-mod_stargazer(stargazer(rus_sum_emp,summary=TRUE,title="Russia Survey",covariate.labels=c("Mobilized in Workplace (Only Employed)","Asked by Boss to Turn Out (Only Employed)","Asked by Party Official to Turn Out (Only Employed)","Asked by Gov. Official to Turn Out (Only Employed)"),font.size="footnotesize", digits=2,digits.extra=0,label="russummary",column.sep.width = "-3pt"))

t<-c(t[1:13],t1[13],t[14],t1[14],t[15],t1[15],t[16],t1[16],t[14:length(t)])
t[1:3]<-""
t<-gsub("0.00","0",t,fixed=TRUE)


###########################################
########     TABLE A23     ################
###########################################


ven_sum <- ven[,list(emp_ask,activist_ask,nleader_ask,citysize,income,male,logage,edu,employed,gov,firmsize,owner,manager,computer,partymember,benefits)]

stargazer(ven_sum,summary=TRUE,title="Venezuela Survey",covariate.labels=c("Encouraged by Boss to Turn Out","Requested by Party Activist to Turn Out","Requested by Neighborhood Leader to Turn Out","City Size","Household Income","Male","Age (log)","Education","Employed","Government Employee","Organization Size","Respondent is Firm Owner","Respondent is Firm Manager","Importance of Computer Skills at Work","Member of Political Party","Receives State Benefits"),font.size="footnotesize", digits=2,digits.extra=0,label="russummary",column.sep.width = "1pt")

###########################################
########     FIGURE A3     ################
###########################################

rus_histogram<-ggplot(data=rus, aes(expoutcome)) +
  geom_histogram(bins=5,
                 col="firebrick4",
                 fill="firebrick4",
                 alpha=.4) +
  labs(x="Response on Likelihood of Voting", y="Count of Respondents")+ggtitle("Panel A: Russia Survey")+theme(axis.text = element_text(size=16),axis.title = element_text(size=16),plot.title=element_text(size=18,hjust = 0.5))

ven_histogram<-ggplot(data=ven, aes(vote_intent)) +
  geom_histogram(bins=5,
                 col="firebrick4",
                 fill="firebrick4",
                 alpha=.4) +
  labs(x="Response on Likelihood of Voting", y="Count of Respondents")+ggtitle("\nPanel B: Venezuela Survey")+theme(axis.text = element_text(size=16),axis.title = element_text(size=16),plot.title=element_text(size=18,hjust = 0.5))